package router

import (
	"api-gateway/handler/api"
	"api-gateway/pkg"

	"github.com/gin-gonic/gin"
)

func Router() *gin.Engine {
	router := gin.Default()
	router.GET("/")

	pkg.Cors() //跨域
	router.POST("/DChat", api.DChat)

	router.GET("/DChat", api.DChat) //用户与骑手聊天
	router.GET("/AChat", api.AChat) //用户与客服聊天

	router.POST("/login", api.Login)                     //登录
	router.POST("/register", api.Register)               //注册
	router.POST("/userNewPassword", api.UserNewPassword) //找回密码
	router.POST("/sendSms", api.SendSms)                 //短信验证
	router.Use(pkg.JWTAuth("2303a"))
	router.POST("/userInfo", api.UserInfo)      //完善信息
	router.POST("/userIndex", api.UserIndex)    //用户首页
	router.POST("/good/create", api.GoodCreate) //商品添加
	router.POST("/good/update", api.GoodUpdate) //商品修改
	return router
}
